<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<script>

	$().ready(function() {
	
		$("#previousPage").click(function(){
			
			if (${page.previousPageNo} < ${page.pageNo}) {
				
				//window.location.href = "<c:url value="${url}" />?pageNo=${page.previousPageNo}";
				$("#<c:out value="${param.formId}"></c:out>").attr("action","<c:url value="${param.url}" />?pageNo=${page.previousPageNo}");
				$("#<c:out value="${param.formId}"></c:out>").submit();
			}
		});
		
		$("#nextPage").click(function(){
			
			if (${page.nextPageNo} > ${page.pageNo}) {
				
				//window.location.href = "<c:url value="${url}" />?pageNo=${page.nextPageNo}";
				$("#<c:out value="${param.formId}"></c:out>").attr("action","<c:url value="${param.url}" />?pageNo=${page.nextPageNo}");
				$("#<c:out value="${param.formId}"></c:out>").submit();
			}
		});
		
		$("#pageNum").keypress(function(){
			
			if(event.keyCode==13){
				
				// 判断是否数字
				if ( /^\d+$/g.test($("#pageNum").val()) ) {
					
					// 判断输入是否大于总页数
					if($("#pageNum").val() <= ${page.pageSize}) {
						
						//window.location.href = "<c:url value="${url}" />?pageNo=" + $("#pageNum").val();
						$("#<c:out value="${param.formId}"></c:out>").attr("action","<c:url value="${param.url}" />?pageNo=" + $("#pageNum").val());
						$("#<c:out value="${param.formId}"></c:out>").submit();
					}
				}
			} 
		});
	});
</script>
<span id="previousPage" style="CURSOR: pointer">&lt;&lt;</span>
<input type="text" id="pageNum" name="pageNum" size="2" value="<c:out value="${page.pageNo}"></c:out>" />
总计
<c:out value="${page.totalPages}"></c:out>
页${page.nextPageNo}
<span id="nextPage" style="CURSOR: pointer">&gt;&gt;</span>
